<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@page import="no.spk.util.inforama.*"%>
<%@page import="no.spk.util.inforama.analyze.impl.ContainerAnalyzerImpl"%>
<%@page import="no.spk.util.inforama.web.impl.InfoRamaWebControllerImpl"%>
<%@page import="no.spk.util.inforama.service.deployable.Deployable"%>
<%@page import="org.springframework.context.ApplicationContext"%>
<%@page	import="org.springframework.web.context.support.WebApplicationContextUtils"%><html>
<%@page import="javax.servlet.http.*,javax.servlet.*,java.util.*,java.lang.*,java.io.*,no.spk.util.inforama.web.*"%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>InfoRama</title>
</head>
<body bgcolor="#F6F9ED">
<form action="index.jsp" method="post">
<%
	ApplicationContext ctx = WebApplicationContextUtils
			.getWebApplicationContext(application);
	InfoRamaWebController wc = (InfoRamaWebController) ctx
			.getBean("inforamaWebController");
%>
<center>
<h1 style="font-family: arial, 'lucida console', sans-serif"><b>InfoRama</b></h1>
<br />
<br />
</center>
<table border="1" align="center" width="50%" bordercolor="#607B8B" cellpadding="3" cellspacing="3">
	<tr>
		<%
			String selectedContainerName = null;
			List<String> containerNames = wc.getContainerNames();
		%>
		<th align="center">Deployed wars on <select name="containerName" onchange="selectedContainerName = this.options[this.selectedIndex].value;">
			<%
				for (String containerName : wc.getContainerNames()) {
			%>
			<option value="<%=containerName%>"><%=containerName%></option>
			<%
				}
			%>
		</select></th>
	</tr>
	<%
		System.out.print( request.getParameter("containerName") );
		System.out.print ( "Selected: " + selectedContainerName );
		for (Deployable deployable : wc.getDeployables( wc.getContainerNames().get(1) )) {
	%>
	<tr>
		<td align="center">
		<table border="1" align="center" width="95%" bordercolor="#8B5742" cellpadding="3" cellspacing="3">
			<tr>
				<th colspan="2" align="center" width="100%"><%=deployable.getDeployableName()%></th>
			</tr>
			<tr>
				<td width="50%">groupId:</td>
				<td width="50%"><font color="#6E8B3D"><%=deployable.getGroupId()%></font></td>
			</tr>
			<tr>
				<td width="50%">artifactId:</td>
				<td width="50%"><font color="#6E8B3D"><%=deployable.getArtifactId()%></font></td>
			</tr>
			<tr>
				<td width="50%">version:</td>
				<%
					if (!deployable.getVersionAsString().endsWith("SNAPSHOT")) {
				%>
				<td width="50%"><font color="#6E8B3D"><%=deployable.getVersionAsString()%></font></td>
				<%
					} else {
				%>
				<td width="50%"><font color="#FF0000"><%=deployable.getVersionAsString()%></font></td>
				<%
					}
				%>
			</tr>
		</table>

		</td>
	</tr>
	<%
		}
	%>
</table>
<INPUT TYPE="submit" VALUE="Submit">
</form>
</body>
</html>